<%@ page pageEncoding="UTF-8"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="isperp" uri="/WEB-INF/tlds/isperp.tld"%>

<div class="header">
	<h2>
		绩效考核信息<span><font color="red">（* 为必填项）</font> </span>
	</h2>
</div>
<script type="text/javascript">
	function cusAction(rowObject) {
		var sourceId = $("#id").val();
		var perItemId = rowObject.id;
		return "<a onclick=addPreItemDetail('" + sourceId + "','" + perItemId + "')>评价</a>";
	}

	function addPreItemDetail(id, itemId) {
		isperp.openDialog({
			id : "addPreItemDetailDialog",
			windowSize : "normal",
			contentUrl : 'performance/performanceItemDetail/edit?pcontrolid=preItemDetailGrid&sourceId=' + id + '&itemId=' + itemId + '&type=1',
			title : "新增"
		});
	}
	function checkScore(cellvalue) {
		if (!cellvalue || cellvalue == null)
			return "<span style='color:red'>未评价</span>";
		else
			return cellvalue;
	}
	function LoadScore(data) {
		var totalScore = 0;
		for ( var i = 0; i < data.length; i++) {
			if (data[i].manager_score != null)
				totalScore += data[i].manager_score;
		}
		$("#managerTotalScoreText").text(totalScore);
		$("#managerTotalScore").val(totalScore);
	}
	function formatText(v) {
		if (v != null)
			return "<pre>" + v + "</pre>";
		else
			return "";
	}
	function formatText4(v) {
		if (v != null)
			return "<div style='width:85%'><pre>" + v + "</pre></div>";
		else
			return "";
	}
</script>
<style>
.ui-jqgrid-view .ui-jqgrid-bdiv td {
	white-space: nowrap;
	text-indent: 6px;
	text-overflow: initial;
	overflow: inherit;
	padding: 0px;
	font-size: 11px;
}
</style>
<form:form commandName="model" cssClass="validate" id="performanceForm"
	action="performance/performance/save">
	<form:hidden path="id" />
	<div class="box" style="overflow: hidden">
		<isperp:processProcesser processId="${model.processId }"></isperp:processProcesser>

	</div>
	<table class=" form-table">
		<tbody>

			<tr>
				<td class="td1">被考核人：</td>
				<td class="td2">${model.perUserFullname }</td>

				<td class="td1">岗位：</td>
				<td class="td2"><form:input path="positionName"
						style="display:none" /> ${model.positionName }</td>
			</tr>

			<tr>
				<td class="td1">考核时间：</td>
				<td class="td2">
					<div id="dateSelector" style="display:inline-block;">
						${model.perYear }年${model.perMonth }月
				</td>

				<td class="td1">主管：</td>
				<td class="td2">${model.managerFullname }</td>
			</tr>
			<tr>
				<td class="td1">提交人评级：</td>
				<td class="td2">${model.perLevel}</td>
				<td class="td1">自评总分：</td>
				<td class="td2" colspan="3"><span id="selfTotalScore"
					style="color:red">${model.selfTotalScore}</span></td>
			</tr>
			<tr>
				<td class="td1">提交人自评：</td>
				<td class="td2" colspan="3"><pre>${model.selfDescription }</pre>
				</td>
			</tr>
			<tr>
				<td colspan="4">
					<div class="header">
						<h2>主管评价</h2>
					</div>
				<td>
			</tr>

			<tr>
				<td class="td1">评价等级：</td>
				<td class="td2">${model.perLevelManager}</td>

				<td class="td1">主管总评分：</td>
				<td class="td2" colspan="3"><span style="color:red">${model.managerTotalScore}</span></td>
			</tr>
			<tr>
				<td class="td1">主管评价：</td>
				<td class="td2" colspan="3">${model.perLevelManager}</td>
			</tr>

		</tbody>
	</table>
</form:form>
<div class="header">
	<h2>
		各项指标完成情况<span></span>
	</h2>
</div>
<isperp:grid
	url="performance/performanceItemDetail/listData?sourceId=${model.id }"
	gridId="preItemDetailGrid" showPager="false" showSearchbar="false"
	showToolbar="false" cusDialogSize="big" 
	 cusFormatterActions="false" >
	<jsp:body>
		<isperp:column name="id" title="id" hidden="true"></isperp:column>
	    <isperp:column name="name" title="指标名称" width="70"
			formatter="return formatText(cellvalue)" isFormatterFun="true"></isperp:column>
	    <isperp:column name="target" title="目标" width="150"
			formatter="return formatText(cellvalue)" isFormatterFun="true"></isperp:column>
	    <isperp:column name="referenc_point" title="衡量标准" width="150"
			formatter="return formatText(cellvalue)" isFormatterFun="true"></isperp:column>
	    <isperp:column name="weight" title="权重" width="40"></isperp:column>
	    <isperp:column name="self_score" title="自评分" width="50"></isperp:column>
	     <isperp:column name="situation" title="自评价" width="70"
			formatter="return formatText(cellvalue)" isFormatterFun="true"></isperp:column>
	    <isperp:column name="manager_score" title="主管评分" width="60"
			isFormatterFun="true" formatter="return checkScore(cellvalue)"></isperp:column>
	    <isperp:column name="manager_evaluate" title="主管评价" width="70"
			formatter="return formatText4(cellvalue)" isFormatterFun="true"></isperp:column>  
	</jsp:body>
</isperp:grid>

<isperp:buttonList>
</isperp:buttonList>
<script type="text/javascript">
	function beforeSubmit() {
		return true;
	}
</script>

